package com.gl.codewar.template;


public class RedundantAcronymSyndrome {

	public static String format(String txt) {
		StringBuilder sb = new StringBuilder();
		StringBuilder phinalPhrase= new StringBuilder();
		String lastWord=null;
		String[] cad = txt.split("\n");
		
		for (String string : cad) {
				
			if(!string.toUpperCase().equals("END")){
			String[] pal = string.split(" ");
			for (String string2 : pal) {
				sb.append(string2.substring(0, 1).toUpperCase());
				lastWord = string2;
				}
			phinalPhrase.append(sb.toString()+" "+ lastWord+"\n");
			}
			
			sb = new StringBuilder();
		
		}		
		String cade = phinalPhrase.toString();
		return cade;
	} 

}
